#coding=utf-8

from selenium import webdriver
import os, time, unittest
import logging
import traceback

class baidu(unittest.TestCase):
	def setUp(self):
		self.chromedriver = "C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chromedriver.exe"
		os.environ['webdriver.chrome.driver'] = self.chromedriver
		self.driver = webdriver.Chrome(self.chromedriver)
		print u'驱动定义完成'
	
	def test_baidu_search(self):
		
		u""" 百度搜索"""
		driver = self.driver
		print u"打开百度"
		
		driver.get('http://baidu.com')
		time.sleep(2)
		print u"打开另一个网址"
		driver.get('http://news.baidu.com')

		time.sleep(1)
		print u"返回上个网页"
		driver.back()
		time.sleep(3)
		driver.forward()
		time.sleep(2)
		driver.back()
		time.sleep(1)
		driver.close()
		driver.quit()
	def test_baidu_set(self):
		driver = self.driver


if __name__ == "__main__":
	unittest.main()
